//
//  DepositListCell.swift
//  SlaughterClient
//
//  Created by 邱仙凯 on 2020/3/16.
//  Copyright © 2020 zwb. All rights reserved.
//

import UIKit
class ZyaDepositListCell: UITableViewCell {
    
    @IBOutlet weak var bg: UIView!
    @IBOutlet weak var lab1: UILabel!
    @IBOutlet weak var lab2: UILabel!
    @IBOutlet weak var lab3: UILabel!
    @IBOutlet weak var lab4: UILabel!
    
    var ob:OperateBtnGroup!
    var obClickAction:((String)->())?
    override func awakeFromNib() {
        super.awakeFromNib()
        bg.layer.masksToBounds = true
        bg.layer.cornerRadius = 5
     
        self.selectionStyle = .none
        self.ob = OperateBtnGroup(frame: CGRect(x:20,y:self.frame.height - 44,width:KSGlobal.screenW - 40,height:32), titles: [])
        self.addSubview(self.ob)
        
    }
    
    var one = ZyaDepositModel(JSON:["":""])! {
        didSet {
            
       
            if one.auditMark == "0" {
                lab1.text = "付款人：\(one.zPayerNm.unwrap)"
                lab2.text = "付款时间：\(one.zPayDt.unwrap)"
                lab3.text = ""
                lab4.text = ""
                self.ob.setTitle( [])
            } else if one.auditMark == "1" {
                lab1.text = "付款人：\(one.zPayerNm.unwrap)"
                lab2.text = "付款金额：\(one.zMoney.unwrap)"
                lab3.text = "付款时间：\(one.zPayDt.unwrap)"
                lab4.text = ""
                self.ob.setTitle(["退款"])
            } else if one.auditMark == "2" {
                lab1.text = "付款人：\(one.zPayerNm.unwrap)"
                lab2.text = "付款金额：\(one.zMoney.unwrap)"
                lab3.text = "付款时间：\(one.zPayDt.unwrap)"
                lab4.text = ""
                self.ob.setTitle([])
            } else if one.auditMark == "3" {
                lab1.text = "付款人：\(one.zPayerNm.unwrap)"
                lab2.text = "付款金额：\(one.zMoney.unwrap)"
                lab3.text = "付款时间：\(one.zPayDt.unwrap)"
                lab4.text = ""
                self.ob.setTitle( [])
            }
            self.ob.clickAction = { tag,title in
                if let closure = self.obClickAction {
                    closure(title)
                }
            }
            
            
            
        }
    }
    override func layoutSubviews() {
        self.ob.frame = CGRect(x:20,y:self.frame.height - 44,width:KSGlobal.screenW - 40,height:32)
    }
    
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        
        // Configure the view for the selected state
    }
    
}
